//
//  MeetingRoomView.m
//  Weiweiyunshi
//
//  Created by 王译 on 17/2/10.
//  Copyright © 2017年 王译. All rights reserved.
//

#import "MeetingRoomView.h"

@implementation MeetingRoomView

- (instancetype)init
{
    self = [super init];
    if (self) {
        [self createView];
    }
    return self;
}

-(void)createView{
    _imgView = [[UIImageView alloc]init];
    _nameLabel = [[UILabel alloc]init];
    _enterBtn = [[UIButton alloc]init];
    _statusLabel = [[UILabel alloc]init];
    _joinerNumLabel = [[UILabel alloc]init];
    _lockBtn = [[UIButton alloc]init];
    _inviteBtn = [[UIButton alloc]init];
    _entryBtn = [[UIButton alloc]init];
    
    [_enterBtn setTitle:@"进入我的会议室" forState:UIControlStateNormal];
    
    NSArray <UIView *> *layOutArr = @[_imgView,_nameLabel,_enterBtn,_statusLabel,_joinerNumLabel,_lockBtn,_inviteBtn,_entryBtn];
    
    
    _entryBtn.backgroundColor = [UIColor colorWithRed:23 green:146 blue:197];
    _lockBtn.backgroundColor = [UIColor colorWithRed:243 green:230 blue:159];
    _inviteBtn.backgroundColor = [UIColor colorWithRed:241 green:158 blue:157];
    
    self.backgroundColor = [UIColor colorWithRed:240 green:239 blue:245];
    _nameLabel.textAlignment = NSTextAlignmentCenter;
    _nameLabel.text = @"高超";
    _enterBtn.backgroundColor = [UIColor colorWithRed:84 green:215 blue:105];
    _statusLabel.backgroundColor = [UIColor whiteColor];
    _joinerNumLabel.backgroundColor = [UIColor whiteColor];
    _enterBtn.sd_cornerRadius = @5;
    _statusLabel.layer.borderColor = [[UIColor blackColor]CGColor];
    _statusLabel.layer.borderWidth = 0.5f;
    _statusLabel.layer.masksToBounds = YES;
    _statusLabel.layer.cornerRadius = 5;
    _statusLabel.textAlignment = NSTextAlignmentCenter;
    _joinerNumLabel.layer.borderColor = [[UIColor blackColor]CGColor];
    _joinerNumLabel.layer.borderWidth = 0.5f;
    _joinerNumLabel.layer.masksToBounds = YES;
    _joinerNumLabel.layer.cornerRadius = 5;
    _joinerNumLabel.textAlignment = NSTextAlignmentCenter;
    
   
    [_lockBtn setTitle:@"锁定" forState:UIControlStateNormal];
    [_inviteBtn setTitle:@"邀请" forState:UIControlStateNormal];
    [_entryBtn setTitle:@"加密" forState:UIControlStateNormal];
    
    
    
    [self sd_addSubviews:layOutArr];
    
    _imgView.sd_layout
    .centerXEqualToView(self)
    .topSpaceToView(self,100)
    .widthIs(100)
    .heightEqualToWidth();
    
    _imgView.sd_cornerRadius = @5;
    
    _nameLabel.sd_layout
    .centerXEqualToView(self)
    .topSpaceToView(_imgView,5)
    .widthRatioToView(_imgView,1)
    .heightIs(30);
    
    _enterBtn.sd_layout
    .centerXEqualToView(self)
    .topSpaceToView(_nameLabel,10)
    .widthRatioToView(self,0.8)
    .heightIs(40);
    
    _statusLabel.sd_layout
    .topSpaceToView(_enterBtn,10)
    .leftEqualToView(_enterBtn)
    .heightRatioToView(_enterBtn,1)
    .widthRatioToView(_enterBtn,0.48);
    
    _joinerNumLabel.sd_layout
    .topSpaceToView(_enterBtn,10)
    .rightEqualToView(_enterBtn)
    .heightRatioToView(_enterBtn,1)
    .widthRatioToView(_enterBtn,0.48);
    
    _entryBtn.sd_layout
    .bottomSpaceToView(self,50)
    .leftEqualToView(_enterBtn)
    .widthRatioToView(_enterBtn,0.333)
    .heightIs(60);
    
    _inviteBtn.sd_layout
    .bottomEqualToView(_entryBtn)
    .centerXEqualToView(self)
    .widthRatioToView(_enterBtn,0.333)
    .heightRatioToView(_entryBtn,1);
    
    _lockBtn.sd_layout
    .bottomEqualToView(_entryBtn)
    .rightEqualToView(_enterBtn)
    .widthRatioToView(_enterBtn,0.333)
    .heightRatioToView(_entryBtn,1);
    
    self.userInteractionEnabled = YES;
}

@end
